package top.wshape1.rpc.consumer.tolerant;

import top.wshape1.rpc.common.entity.ServiceMeta;

import java.util.function.Function;

/**
 * @author Wshape1
 * @version 1.0
 * @description 容错策略
 * @since 2024-02-15
 */

public interface FaultTolerantStrategy {

    /**
     * handle fault
     *
     * @param invoker        invoke function
     * @param curServiceMeta current service meta
     * @param error          error
     * @return result
     */
    Object handle(Function<ServiceMeta, Object> invoker, ServiceMeta curServiceMeta, Exception error);

}
